package org.lcx.pipeline.example;

import java.util.HashMap;
import java.util.Map;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

import org.lcx.pipeline.PipelineManager;

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = { "classpath*:org/lcx/pipeline/example/pipeline-example.xml" })
public class TestChain {

	@Autowired
	private PipelineManager pipelineManager;

	/**
	 * 默认情况下，maven不会打包xml文件，需要运行此方法，参考：https://blog.csdn.net/qq_27840695/article/details/81095601
	 */
	@Test
	public void testPipeline() {
		try {
			Map<String, Object> params = new HashMap<String, Object>();
			params.put("name", "黄小明");
			pipelineManager.runProcess("testPipelineChain", params);
			System.out.println("pipelineChainName运行完毕");
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

}
